/***************************************************************************

-------------------
    begin                : 
    copyright            : kuzkok
    email                : kuzkok at gmail.com

***************************************************************************
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*   
*   Данная программа является свободным программным обеспечением;         *
*   Вы можете распространять ее и/или модифицировать в соответствии с     *
*   GNU General Public License опубликованной Фондом свободного           *
*   программного обеспечения; используемая версия лицензии - 2 или        *
*   (по вашему выбору) любая более поздняя                                *
***************************************************************************/

#include "onlinepointfacility.h"

OnlinePointFacility::OnlinePointFacility(QString theTableName) :
        OnlineFacility(theTableName)
{
}

OnlinePointFacility::OnlinePointFacility(QUuid theEventID, QString theTableName) :
        OnlineFacility(theEventID, theTableName)
{
    if(mObjectState)
    {
        mStation = mSelectQuery->value(mSelectQuery->record().indexOf("station")).toDouble();
        mSymbolRotation = mSelectQuery->value(mSelectQuery->record().indexOf("symbolrotation")).toDouble();
    }
}

void OnlinePointFacility::buildInsertStatement()
{
    OnlineFacility::buildInsertStatement();
    mInsertStatementFields += ", station"
                             ", symbolrotation";
    mInsertStatementValues += ", :station"
                             ", :symbolrotation";
}

void OnlinePointFacility::buildUpdateStatement()
{
    OnlineFacility::buildUpdateStatement();
    mUpdateStatement += ", station = :station"
                       ", symbolrotation = :symbolrotation";
}

void OnlinePointFacility::bindQueryValues(QSqlQuery &query)
{
    OnlineFacility::bindQueryValues(query);
    query.bindValue(":station", mStation);
    query.bindValue(":symbolrotation", mSymbolRotation);
}
